

#ifndef FIFOMEMORYTABLE_H_
#define FIFOMEMORYTABLE_H_

#include "../../Packets/BackSubPkt.h"
#include "../../Packets/PubPkt.h"
#include "../../Common/TimeMs.h"
#include <boost/unordered_map.hpp>
#include <string>
#include <queue>
#include "../../Memory/MemoryWrapper.h"
#include <iostream>
#include "MemoryTable.h"
#include "../../Common/Consts.h"
#include "OCMMemoryTable.h"


class FIFOMemoryTable : public OCMMemoryTable {

public:

	FIFOMemoryTable(int parNumMaxSlot, MemoryWrapper* parMemory);

	virtual ~FIFOMemoryTable();

	void computeInsertion(PubPkt *pkt, int ns, float ws, float lastPercentage);

	void computeExtraction(BackSubPkt *pkt, std::set<PubPkt*> &resultSet);


private:

	std::priority_queue<std::pair<timestamp_t, key_t> > queue;

	int numMaxSlot;
	int numUsedSlot;
	int keyCounter;
	MemoryWrapper *memory;

	Timer *timer;
};

#endif /* FIFOMEMORYTABLE_H_ */
